#include <iostream>

using namespace std;

/*
int main() {
    int a = 0;
    auto b = a;
    auto c = &a;
    double d = 0;
    cout << typeid(b).name() << endl;//获取变量的类型
    cout << typeid(c).name() << endl;
    cout << typeid(d).name() << endl;
    return 0;
}
 */

/*
typedef char* pstring;

int main(){
    const pstring p1 = nullptr;//实际为 char* const p1,即p1为常性，必须初始化
    const pstring *p2;
    return 0;
}
*/

/*
 class Data{
 public:
     void Init(int year = 2020, int month = 05, int day = 20){
         cout << this << endl;
         _year = year;
         _month = month;
         _day = day;
     }
     void func(){
         cout << this << endl;
         cout << "func()" << endl;
     }
     int _year;
     int _month;
     int _day;
 };

 int main(){
     Data* ptr = nullptr;
     ptr->Init();//运行崩溃：调用成员函数后，访问对象空指针解引用
     ptr->func();//正常运行:func()不在对象里，在公共代码段，不需要解引用
     ptr->_year;//运行崩溃：访问对象时空指针解引用
     (*ptr).func();//正常运行：func()在公共代码段，只传递给this，不需要解引用
     return 0;
 }
 */

/*
int main(){
    int array[] = {1,2,3,4,5,6};
    for (auto p : array) {
        p *= 2;
        cout << p << ' ';
    }
    cout << endl;
    for (auto p : array) {
        cout << p << ' ';
    }
    cout << endl;
    for (auto& p : array) {
        p *= 2;
        cout << p << ' ';
    }
    cout << endl;
    for (auto p : array) {
        cout << p << ' ';
    }
    cout << endl;
    return 0;
}
*/

